home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / program / ddj0897.zip / DYN401.ZIP / class / stream.d < prev    next >
Text File  |  1996-09-15  |  1KB  |  77 lines

  1.  
  2. /*
  3.  *
  4.  *    Copyright (c) 1993-1996 Algorithms Corporation
  5.  *    3020 Liberty Hills Drive
  6.  *    Franklin, TN  37067
  7.  *
  8.  *    ALL RIGHTS RESERVED.
  9.  *
  10.  *
  11.  *
  12.  */
  13.  
  14.  
  15. #include <string.h>
  16.  
  17.  
  18. defclass  Stream  {
  19.  init:  class_init;
  20. };
  21.  
  22.  
  23. object    stdoutStream_o, stdinStream_o, stderrStream_o, traceStream_o;
  24.  
  25.  
  26. imeth    int    gPuts(char *str)    /*  or String object  */
  27. {
  28.     if (IsObj((object)str))
  29.         str = gStringValue((object)str);
  30.     return gWrite(self, str, strlen(str));
  31. }
  32.  
  33. imeth    int    gPutc(int i)
  34. {
  35.     char    c = (char) i;
  36.     return 1 == (gWrite(self, &c, 1)) ? i : EOF;
  37. }
  38.  
  39. ivmeth    int    vPrintf(char *fmt, ...)
  40. {
  41.     char    buf[256];
  42.     MAKE_REST(fmt);
  43.  
  44.     vsprintf(buf, fmt, _rest_);
  45.     return gWrite(self, buf, strlen(buf));
  46. }
  47.  
  48. imeth    gCopy, gDeepCopy ()
  49. {
  50.     return gShouldNotImplement(self, "Copy/DeepCopy");
  51. }
  52.  
  53. static    void    class_init(void)
  54. {
  55.     Dynace;
  56.     RegisterVariable(stdoutStream_o);
  57.     RegisterVariable(stderrStream_o);
  58.     RegisterVariable(stdinStream_o);
  59.     RegisterVariable(traceStream_o);
  60. }
  61.  
  62.  
  63.  
  64.  
  65. /*
  66.  *
  67.  *    Copyright (c) 1993-1996 Algorithms Corporation
  68.  *    3020 Liberty Hills Drive
  69.  *    Franklin, TN  37067
  70.  *
  71.  *    ALL RIGHTS RESERVED.
  72.  *
  73.  *
  74.  *
  75.  */
  76.  
  77.